﻿using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;

namespace Ls.Web.Framework.Extensions
{
    public static class AuthenticationServiceCollectionExtensions
    {
        public static AuthenticationBuilder AddSxAuthentication(this IServiceCollection services) {
            services.AddPermissions();
            return   services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(o => {
                o.Cookie.Name = ".sx"; // CookieName  授权的Cookie名字
                   o.LoginPath = new PathString("/login");
            });
        }
    }
}
